<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <meta>
  <!-- Stylesheets -->
  <link href="../web.css" type="text/css" rel="stylesheet"></link>
  <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link>
  <title>VLFeat - Documentation - C API</title>
  <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>

  <!-- Scripts-->
  
 </meta>

 <!-- Body Start -->
 <body>
  <div id="header">
   <!-- Google CSE Search Box Begins -->
   <form action="http://www.vlfeat.org/search.html" method="get" id="cse-search-box" enctype="application/x-www-form-urlencoded">
    <div>
     <input type="hidden" name="cx" value="003215582122030917471:oq23albfeam"></input>
     <input type="hidden" name="cof" value="FORID:11"></input>
     <input type="hidden" name="ie" value="UTF-8"></input>
     <input type="text" name="q" size="31"></input>
     <input type="submit" name="sa" value="Search"></input>
    </div>
   </form>
   <script src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en" xml:space="preserve" type="text/javascript"></script>
   <!-- Google CSE Search Box Ends -->
   <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1>
  </div>
  <div id="headbanner">
   Documentation - C API
  </div>
  <div id="pagebody">
   <div id="sidebar"> <!-- Navigation Start -->
    <ul>
<li><a href="../index.html">Home</a>
</li>
<li><a href="../download.html">Download</a>
</li>
<li><a href="../doc.html">Documentation</a>
<ul>
<li><a href="../mdoc/mdoc.html">Matlab API</a>
</li>
<li><a href="index.html" class='active' >C API</a>
</li>
<li><a href="../man/man.html">Man pages</a>
</li>
</ul></li>
<li><a href="../overview/tut.html">Tutorials</a>
</li>
<li><a href="../applications/apps.html">Applications</a>
</li>
</ul>

   </div> <!-- sidebar -->
   <div id="content">
    
    <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>
    <div class="doxygen">
<div>
<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">imopv.h File Reference</div>  </div>
</div>
<div class="contents">

<p>Vectorized image operations.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="generic_8h.html">generic.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Image convolution flags</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af6e169f2ed366d16f9149a99d5574071"></a><!-- doxytag: member="imopv.h::VL_PAD_BY_ZERO" ref="af6e169f2ed366d16f9149a99d5574071" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#af6e169f2ed366d16f9149a99d5574071">VL_PAD_BY_ZERO</a>&#160;&#160;&#160;(0x0 &lt;&lt; 0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pad with zeroes. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aabcdd51c289c0d8db11dda9e26349a52"></a><!-- doxytag: member="imopv.h::VL_PAD_BY_CONTINUITY" ref="aabcdd51c289c0d8db11dda9e26349a52" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#aabcdd51c289c0d8db11dda9e26349a52">VL_PAD_BY_CONTINUITY</a>&#160;&#160;&#160;(0x1 &lt;&lt; 0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pad by continuity. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a4f0c469409eea71985bac3f10d08fb"></a><!-- doxytag: member="imopv.h::VL_PAD_MASK" ref="a2a4f0c469409eea71985bac3f10d08fb" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a2a4f0c469409eea71985bac3f10d08fb">VL_PAD_MASK</a>&#160;&#160;&#160;(0x3)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Padding field selector. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2489ff30a8c5d4048038a90b640a038a"></a><!-- doxytag: member="imopv.h::VL_TRANSPOSE" ref="a2489ff30a8c5d4048038a90b640a038a" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a2489ff30a8c5d4048038a90b640a038a">VL_TRANSPOSE</a>&#160;&#160;&#160;(0x1 &lt;&lt; 2)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Transpose result. <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Image convolution</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a032ec58dd2542db69351e006fbac1b13">vl_imconvcol_vf</a> (float *dst, int dst_stride, float const *src, int src_width, int src_height, int src_stride, float const *filt, int filt_begin, int filt_end, int step, unsigned int flags)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a165f552920957a65884b0937034e4c9a">vl_imconvcol_vd</a> (double *dst, int dst_stride, double const *src, int src_width, int src_height, int src_stride, double const *filt, int filt_begin, int filt_end, int step, unsigned int flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Convolve image along columns.  <a href="#a165f552920957a65884b0937034e4c9a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#ab5561b2ed447b0099e7bf8dc79915382">vl_imconvcoltri_f</a> (float *dest, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> destStride, float const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageWidth, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageHeight, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageStride, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> filterSize, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> step, int unsigned flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Convolve an image along the columns with a triangular kernel.  <a href="#ab5561b2ed447b0099e7bf8dc79915382"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#ad624650d3ab3d609f68634f83623677c">vl_imconvcoltri_d</a> (double *dest, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> destStride, double const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageWidth, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageHeight, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageStride, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> filterSize, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> step, int unsigned flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Convolve an image along the columns with a triangular kernel.  <a href="#ad624650d3ab3d609f68634f83623677c"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Integral image</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a783087728b77a88fb701426acf587956">vl_imintegral_f</a> (float *integral, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> integralStride, float const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageWidth, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageHeight, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageStride)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute integral image.  <a href="#a783087728b77a88fb701426acf587956"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a63f63ca0445077d4baf05db04a1921e5">vl_imintegral_d</a> (double *integral, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> integralStride, double const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageWidth, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageHeight, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageStride)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute integral image.  <a href="#a63f63ca0445077d4baf05db04a1921e5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#a33c2c2a2dc57e86aa03f0f5288001c46">vl_imintegral_i32</a> (<a class="el" href="host_8h.html#a03fa435c713d3141c4a700f79f5b2600">vl_int32</a> *integral, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> integralStride, <a class="el" href="host_8h.html#a03fa435c713d3141c4a700f79f5b2600">vl_int32</a> const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageWidth, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageHeight, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageStride)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute integral image.  <a href="#a33c2c2a2dc57e86aa03f0f5288001c46"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#ab02ddbe089220e3c33c548d2b45887a1">vl_imintegral_ui32</a> (<a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> *integral, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> integralStride, <a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageWidth, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageHeight, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> imageStride)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute integral image.  <a href="#ab02ddbe089220e3c33c548d2b45887a1"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Distance transform</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#ad13a54f025599cbde1e2f073733872b2">vl_image_distance_transform_d</a> (double const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numColumns, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numRows, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> columnStride, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> rowStride, double *distanceTransform, <a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a> *indexes, double coeff, double offset)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the distance transform of an image.  <a href="#ad13a54f025599cbde1e2f073733872b2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="imopv_8h.html#ac20d3690d57a30ddb2937d051abaf192">vl_image_distance_transform_f</a> (float const *image, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numColumns, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numRows, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> columnStride, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> rowStride, float *distanceTransform, <a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a> *indexes, float coeff, float offset)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>This module provides the following image operations:</p>
<ul>
<li><b>Separable convolution.</b> The function <a class="el" href="imopv_8h.html#a032ec58dd2542db69351e006fbac1b13">vl_imconvcol_vf()</a> can be used to compute separable convolutions.</li>
</ul>
<ul>
<li><b>Convolution by a triangular kernel.</b> The function vl_imconvcoltri_vf() is an optimized convolution routine for triangular kernels.</li>
</ul>
<ul>
<li><b>Distance transform.</b> <a class="el" href="imopv_8h.html#ac20d3690d57a30ddb2937d051abaf192">vl_image_distance_transform_f()</a> is a linear algorithm to compute the distance transform of an image.</li>
</ul>
<dl class="remark"><dt><b>Remarks:</b></dt><dd>Some operations are optimized to exploit possible SIMD instructions. This requires image data to be properly aligned (typically to 16 bytes). Similalry, the image stride (the number of bytes to skip to move to the next image row), must be aligned.</dd></dl>
<dl class="author"><dt><b>Author:</b></dt><dd>Andrea Vedaldi </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="ad13a54f025599cbde1e2f073733872b2"></a><!-- doxytag: member="imopv.h::vl_image_distance_transform_d" ref="ad13a54f025599cbde1e2f073733872b2" args="(double const *image, vl_size numColumns, vl_size numRows, vl_size columnStride, vl_size rowStride, double *distanceTransform, vl_uindex *indexes, double coeff, double offset)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_image_distance_transform_d </td>
          <td>(</td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numColumns</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numRows</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>columnStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>rowStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>distanceTransform</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a> *&#160;</td>
          <td class="paramname"><em>indexes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>coeff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">image</td><td>image. </td></tr>
    <tr><td class="paramname">numColumns</td><td>number of columns of the image. </td></tr>
    <tr><td class="paramname">numRows</td><td>number of rows of the image. </td></tr>
    <tr><td class="paramname">columnStride</td><td>offset from one column to the next. </td></tr>
    <tr><td class="paramname">rowStride</td><td>offset from one row to the next. </td></tr>
    <tr><td class="paramname">distanceTransform</td><td>distance transform (out). </td></tr>
    <tr><td class="paramname">indexes</td><td>nearest neighbor indexes (in/out). </td></tr>
    <tr><td class="paramname">coeff</td><td>quadratic cost coefficient (non-negative). </td></tr>
    <tr><td class="paramname">offset</td><td>quadratic cost offset.</td></tr>
  </table>
  </dd>
</dl>
<p>The function computes the distance transform along the first dimension of the image <em>image</em>. Let <img class="formulaInl" alt="$ I(u,v) $" src="form_109.png"/> be <em>image</em>. Its distance transfrom <img class="formulaInl" alt="$ D(u,v) $" src="form_110.png"/> is given by:</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ u^*(u,v) = \min_{u'} I(u',v) + \mathtt{coeff} (u' - u - \mathtt{offset})^2, \quad D(u,v) = I(u^*(u,v),v). \]" src="form_111.png"/>
</p>
<p>Notice that <em>coeff</em> must be non negative.</p>
<p>The function fills in the buffer <em>distanceTransform</em> with <img class="formulaInl" alt="$ D $" src="form_112.png"/>. This buffer must have the same size as <em>image</em>.</p>
<p>If <em>indexes</em> is not <code>NULL</code>, it must be a matrix of the same size o the image. The function interprets the value of this matrix as indexes of the pixels, i.e <img class="formulaInl" alt="$ \mathtt{indexes}(u,v) $" src="form_113.png"/> is the index of pixel <img class="formulaInl" alt="$ (u,v) $" src="form_114.png"/>. On output, the matrix <em>indexes</em> contains <img class="formulaInl" alt="$ \mathtt{indexes}(u^*(u,v),v) $" src="form_115.png"/>. This information can be used to determine for each pixel <img class="formulaInl" alt="$ (u,v) $" src="form_114.png"/> its &ldquo;nearest neighbor&amp;rdquo.</p>
<p>Notice that by swapping <em>numRows</em> and <em>numColumns</em> and <em>columnStride</em> and <em>rowStride</em>, the function can be made to operate along the other image dimension. Specifically, to compute the distance transform along columns and rows, call the functinon twice:</p>
<div class="fragment"><pre class="fragment">   <span class="keywordflow">for</span> (i = 0 ; i &lt; numColumns * numRows ; ++i) indexes[i] = i ;
   <a class="code" href="imopv_8h.html#ad13a54f025599cbde1e2f073733872b2" title="Compute the distance transform of an image.">vl_image_distance_transform_d</a>(image,numColumns,numRows,1,numColumns,
                                 distanceTransform,indexes,u_coeff,u_offset) ;
   <a class="code" href="imopv_8h.html#ad13a54f025599cbde1e2f073733872b2" title="Compute the distance transform of an image.">vl_image_distance_transform_d</a>(distanceTransform,numRows,numColumns,numColumns,1,
                                 distanceTransform,indexes,u_coeff,u_offset) ;
</pre></div><dl class="user"><dt><b>Algorithm</b></dt><dd></dd></dl>
<p>The function implements the algorithm described in: P. F. Felzenszwalb and D. P. Huttenlocher, <em>Distance Transforms of Sampled Functions,</em> Technical Report, Cornell University, 2004.</p>
<p>Since the algorithm operates along one dimension per time, consider the 1D version of the problem for simplicity:</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ d(y) = \min_{x} g(y;x), \quad g(y;x) = f(x) + \alpha (y - x - \beta)^2, \quad x,y \in \{0,1,\dots,N-1\}. \]" src="form_116.png"/>
</p>
<p>Hence the distance transform <img class="formulaInl" alt="$ d(y) $" src="form_117.png"/> is the lower envelope of the family of parabolas <img class="formulaInl" alt="$ g(y;x) $" src="form_118.png"/> indexed by <img class="formulaInl" alt="$ x $" src="form_92.png"/>. Notice that all parabolas have the same curvature and that their centers are located at <img class="formulaInl" alt="$ x + \beta, $" src="form_119.png"/> <img class="formulaInl" alt="$ x=0,\dots,N-1 $" src="form_120.png"/>. The algorithm considers one parabola per time, from left to right, and finds the interval for which the parabola belongs to the lower envelope (if any).</p>
<p>Initially, only the leftmost parabola <img class="formulaInl" alt="$ g(y;0) $" src="form_121.png"/> has been considered, and its validity interval is <img class="formulaInl" alt="$(-\infty, \infty) $" src="form_122.png"/>. Then the second parabola <img class="formulaInl" alt="$ g(y;1) $" src="form_123.png"/> is considered. As long as <img class="formulaInl" alt="$ \alpha > 0 $" src="form_124.png"/>, the two parabolas <img class="formulaInl" alt="$ g(y;0),\ g(y;1) $" src="form_125.png"/> intersect at a unique point <img class="formulaInl" alt="$ \bar y $" src="form_126.png"/>. Then the first parabola belongs to the envelope in the interval <img class="formulaInl" alt="$ (-\infty, \bar y] $" src="form_127.png"/> and the second one in the interval <img class="formulaInl" alt="$ (\bar y, +\infty] $" src="form_128.png"/>. When the third parabola <img class="formulaInl" alt="$ g(y;2) $" src="form_129.png"/> is considered, the intersection point <img class="formulaInl" alt="$ \hat y $" src="form_130.png"/> with the previously added parabola <img class="formulaInl" alt="$ g(y;1) $" src="form_123.png"/> is found. Now two cases may arise:</p>
<ul>
<li><img class="formulaInl" alt="$ \hat y > \bar y $" src="form_131.png"/>, in which case all three parabolas belong to the envelope in the intervals <img class="formulaInl" alt="$ (-\infty,\bar y], (\bar y, \hat y], (\hat y, +\infty] $" src="form_132.png"/>.</li>
</ul>
<ul>
<li><img class="formulaInl" alt="$ \hat y \leq \bar y $" src="form_133.png"/>, in which case the second parabola <img class="formulaInl" alt="$ g(y;1) $" src="form_123.png"/> has no point beloning to the envelope, and it is removed. One then remains with the two parabolas <img class="formulaInl" alt="$ g(y;0),\ g(y;2) $" src="form_134.png"/> and the algorithm is re-iterated.</li>
</ul>
<p>The algorithm proceeds in this fashion. Every time a new parabola is considered, its intersection point with the previously added parabola on the left is computed, and that parabola is potentially removed. The cost of an iteration is 1 plus the number of deleted parabolas. Since there are <img class="formulaInl" alt="$ N $" src="form_135.png"/> iterations and at most <img class="formulaInl" alt="$ N $" src="form_135.png"/> parabolas to delete overall, the complexity is linear, i.e. <img class="formulaInl" alt="$ O(N) $" src="form_136.png"/>. </p>

</div>
</div>
<a class="anchor" id="ac20d3690d57a30ddb2937d051abaf192"></a><!-- doxytag: member="imopv.h::vl_image_distance_transform_f" ref="ac20d3690d57a30ddb2937d051abaf192" args="(float const *image, vl_size numColumns, vl_size numRows, vl_size columnStride, vl_size rowStride, float *distanceTransform, vl_uindex *indexes, float coeff, float offset)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_image_distance_transform_f </td>
          <td>(</td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numColumns</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numRows</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>columnStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>rowStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>distanceTransform</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a> *&#160;</td>
          <td class="paramname"><em>indexes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>coeff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#ad13a54f025599cbde1e2f073733872b2" title="Compute the distance transform of an image.">vl_image_distance_transform_d</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a165f552920957a65884b0937034e4c9a"></a><!-- doxytag: member="imopv.h::vl_imconvcol_vd" ref="a165f552920957a65884b0937034e4c9a" args="(double *dst, int dst_stride, double const *src, int src_width, int src_height, int src_stride, double const *filt, int filt_begin, int filt_end, int step, unsigned int flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imconvcol_vd </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>dst_stride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>src_width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>src_height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>src_stride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>filt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>filt_begin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>filt_end</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>step</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">dst</td><td>destination image. </td></tr>
    <tr><td class="paramname">dst_stride</td><td>width of the destination image including padding. </td></tr>
    <tr><td class="paramname">src</td><td>source image. </td></tr>
    <tr><td class="paramname">src_width</td><td>width of the source image. </td></tr>
    <tr><td class="paramname">src_height</td><td>height of the source image. </td></tr>
    <tr><td class="paramname">src_stride</td><td>width of the source image including padding. </td></tr>
    <tr><td class="paramname">filt</td><td>filter kernel. </td></tr>
    <tr><td class="paramname">filt_begin</td><td>coordinate of the first filter element. </td></tr>
    <tr><td class="paramname">filt_end</td><td>coordinate of the last filter element. </td></tr>
    <tr><td class="paramname">step</td><td>sub-sampling step. </td></tr>
    <tr><td class="paramname">flags</td><td>operation modes.</td></tr>
  </table>
  </dd>
</dl>
<p>The function convolves the column of the image <em>src</em> by the filter <em>filt</em> and saves the result to the image <em>dst</em>. The size of <em>dst</em> must be equal to the size of <em>src</em>. Formally, this results in the calculation</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \mathrm{dst} [x,y] = \sum_{p=y-\mathrm{filt\_end}}^{y-\mathrm{filt\_begin}} \mathrm{src}[x,y] \mathrm{filt}[y - p - \mathrm{filt\_begin}] \]" src="form_107.png"/>
</p>
<p>The function subsamples the image along the columns according to the parameter <em>step</em>. Setting <em>step</em> to 1 (one) computes the elements <img class="formulaInl" alt="$\mathrm{dst}[x,y]$" src="form_108.png"/> for all pairs (x,0), (x,1), (x,2) and so on. Setting <em>step</em> two 2 (two) computes only (x,0), (x,2) and so on (in this case the height of the destination image is <code>floor(src_height/step)+1)</code>.</p>
<p>Calling twice the function can be used to compute 2-D separable convolutions. Use the flag <a class="el" href="imopv_8h.html#a2489ff30a8c5d4048038a90b640a038a" title="Transpose result.">VL_TRANSPOSE</a> to transpose the result (in this case <em>dst</em> has transposed dimension as well).</p>
<p>The function allows the support of the filter to be any range. Usually the support is <code><em>filt_end</em> = -<em>filt_begin</code></em>.</p>
<p>The convolution operation may pick up values outside the image boundary. To cope with this edge cases, the function either pads the image by zero (<a class="el" href="imopv_8h.html#af6e169f2ed366d16f9149a99d5574071" title="Pad with zeroes.">VL_PAD_BY_ZERO</a>) or with the values at the boundary (<a class="el" href="imopv_8h.html#aabcdd51c289c0d8db11dda9e26349a52" title="Pad by continuity.">VL_PAD_BY_CONTINUITY</a>). </p>

</div>
</div>
<a class="anchor" id="a032ec58dd2542db69351e006fbac1b13"></a><!-- doxytag: member="imopv.h::vl_imconvcol_vf" ref="a032ec58dd2542db69351e006fbac1b13" args="(float *dst, int dst_stride, float const *src, int src_width, int src_height, int src_stride, float const *filt, int filt_begin, int filt_end, int step, unsigned int flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imconvcol_vf </td>
          <td>(</td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>dst_stride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>src_width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>src_height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>src_stride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>filt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>filt_begin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>filt_end</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>step</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#a032ec58dd2542db69351e006fbac1b13">vl_imconvcol_vf()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ad624650d3ab3d609f68634f83623677c"></a><!-- doxytag: member="imopv.h::vl_imconvcoltri_d" ref="ad624650d3ab3d609f68634f83623677c" args="(double *dest, vl_size destStride, double const *image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride, vl_size filterSize, vl_size step, int unsigned flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imconvcoltri_d </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>destStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>filterSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>step</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int unsigned&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">dest</td><td>destination image. </td></tr>
    <tr><td class="paramname">destStride</td><td>destination image stride. </td></tr>
    <tr><td class="paramname">image</td><td>image to convolve. </td></tr>
    <tr><td class="paramname">imageWidth</td><td>width of the image. </td></tr>
    <tr><td class="paramname">imageHeight</td><td>height of the image. </td></tr>
    <tr><td class="paramname">imageStride</td><td>width of the image including padding. </td></tr>
    <tr><td class="paramname">filterSize</td><td>size of the triangular filter. </td></tr>
    <tr><td class="paramname">step</td><td>sub-sampling step. </td></tr>
    <tr><td class="paramname">flags</td><td>operation modes.</td></tr>
  </table>
  </dd>
</dl>
<p>The function convolves the columns of the image <em>image</em> with the triangular kernel</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ k(t) = \frac{1}{\Delta^2} \max\{ \Delta - |t|, 0 \}, \quad t \in \mathbb{Z} \]" src="form_137.png"/>
</p>
<p>The paramter <img class="formulaInl" alt="$ \Delta $" src="form_138.png"/>, equal to the function argument <em>filterSize</em>, controls the width of the kernel. Notice that the support of <img class="formulaInl" alt="$ k(x) $" src="form_139.png"/> as a continuous function of <img class="formulaInl" alt="$ x $" src="form_92.png"/> is the open interval <img class="formulaInl" alt="$ (-\Delta,\Delta) $" src="form_140.png"/>, which has length <img class="formulaInl" alt="$ 2\Delta $" src="form_141.png"/>. However, <img class="formulaInl" alt="$ k(x) $" src="form_139.png"/> restricted to the ingeter domain <img class="formulaInl" alt="$ x \in \mathcal{Z} $" src="form_142.png"/> has support <img class="formulaInl" alt="$ \{ -\Delta + 1, \Delta +2, \dots, \Delta-1 \} $" src="form_143.png"/>, which counts <img class="formulaInl" alt="$ 2 \Delta - 1 $" src="form_144.png"/> elements only. In particular, the discrete kernel is symmetric about the origin for all values of <img class="formulaInl" alt="$ \Delta $" src="form_138.png"/>.</p>
<p>The normalization factor <img class="formulaInl" alt="$ 1 / \Delta^2 $" src="form_145.png"/> guaratnees that the filter is normalized to one, i.e.:</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \sum_{t=-\infty}^{+\infty} k(t) = 1 \]" src="form_146.png"/>
</p>
<dl class="user"><dt><b>Algorithm</b></dt><dd></dd></dl>
<p>The function exploits the fact that convolution by a triangular kernel can be expressed as the repeated convolution by a rectangular kernel, and that the latter can be performed in time indepenedent on the fiter width by using an integral-image type trick. Overall, the algorithm complexity is independent on the parameter <em>filterSize</em> and linear in the nubmer of image pixels.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#a165f552920957a65884b0937034e4c9a" title="Convolve image along columns.">vl_imconvcol_vd</a> for details on the meaning of the other parameters. </dd></dl>

</div>
</div>
<a class="anchor" id="ab5561b2ed447b0099e7bf8dc79915382"></a><!-- doxytag: member="imopv.h::vl_imconvcoltri_f" ref="ab5561b2ed447b0099e7bf8dc79915382" args="(float *dest, vl_size destStride, float const *image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride, vl_size filterSize, vl_size step, int unsigned flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imconvcoltri_f </td>
          <td>(</td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>destStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>filterSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>step</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int unsigned&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#ad624650d3ab3d609f68634f83623677c" title="Convolve an image along the columns with a triangular kernel.">vl_imconvcoltri_d()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a63f63ca0445077d4baf05db04a1921e5"></a><!-- doxytag: member="imopv.h::vl_imintegral_d" ref="a63f63ca0445077d4baf05db04a1921e5" args="(double *integral, vl_size integralStride, double const *image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imintegral_d </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>integral</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>integralStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageStride</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">integral</td><td>integral image. </td></tr>
    <tr><td class="paramname">integralStride</td><td>integral image stride. </td></tr>
    <tr><td class="paramname">image</td><td>source image. </td></tr>
    <tr><td class="paramname">imageWidth</td><td>source image width. </td></tr>
    <tr><td class="paramname">imageHeight</td><td>source image height. </td></tr>
    <tr><td class="paramname">imageStride</td><td>source image stride.</td></tr>
  </table>
  </dd>
</dl>
<p>Let <img class="formulaInl" alt="$ I(x,y), (x,y) \in [0, W-1] \times [0, H-1] $" src="form_147.png"/>. The function computes the integral image <img class="formulaInl" alt="$ J(x,y) $" src="form_148.png"/> of <img class="formulaInl" alt="$ I(x,g) $" src="form_149.png"/>:</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ J(x,y) = \sum_{x'=0}^{x} \sum_{y'=0}^{y} I(x',y') \]" src="form_150.png"/>
</p>
<p>The integral image <img class="formulaInl" alt="$ J(x,y) $" src="form_148.png"/> can be used to compute quickly the integral of of <img class="formulaInl" alt="$ I(x,y) $" src="form_151.png"/> in a rectangular region <img class="formulaInl" alt="$ R = [x',x'']\times[y',y''] $" src="form_152.png"/>:</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \sum_{(x,y)\in[x',x'']\times[y',y'']} I(x,y) = (J(x'',y'') - J(x'-1, y'')) - (J(x'',y'-1) - J(x'-1,y'-1)). \]" src="form_153.png"/>
</p>
<p>Note that the order of operations is important when the integral image has an unsigned data type (e.g. <a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a" title="Unsigned 32-bit integer.">vl_uint32</a>). The formula is easily derived as follows:</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\begin{eqnarray*} \sum_{(x,y)\in R} I(x,y) &amp;=&amp; \sum_{x=x'}^{x''} \sum_{y=y'}^{y''} I(x,y)\\ &amp;=&amp; \sum_{x=0}^{x''} \sum_{y=y'}^{y''} I(x,y) - \sum_{x=0}^{x'-1} \sum_{y=y'}^{y''} I(x,y)\\ &amp;=&amp; \sum_{x=0}^{x''} \sum_{y=0}^{y''} I(x,y) - \sum_{x=0}^{x''} \sum_{y=0}^{y'-1} I(x,y) - \sum_{x=0}^{x'-1} \sum_{y=0}^{y''} I(x,y) + \sum_{x=0}^{x'-1} \sum_{y=0}^{y'-1} I(x,y)\\ &amp;=&amp; J(x'',y'') - J(x'-1,y'') - J(x'',y'-1) + J(x'-1,y'-1). \end{eqnarray*}" src="form_154.png"/>
</p>
 
</div>
</div>
<a class="anchor" id="a783087728b77a88fb701426acf587956"></a><!-- doxytag: member="imopv.h::vl_imintegral_f" ref="a783087728b77a88fb701426acf587956" args="(float *integral, vl_size integralStride, float const *image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imintegral_f </td>
          <td>(</td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>integral</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>integralStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageStride</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#a63f63ca0445077d4baf05db04a1921e5" title="Compute integral image.">vl_imintegral_d</a>. </dd></dl>

</div>
</div>
<a class="anchor" id="a33c2c2a2dc57e86aa03f0f5288001c46"></a><!-- doxytag: member="imopv.h::vl_imintegral_i32" ref="a33c2c2a2dc57e86aa03f0f5288001c46" args="(vl_int32 *integral, vl_size integralStride, vl_int32 const *image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imintegral_i32 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="host_8h.html#a03fa435c713d3141c4a700f79f5b2600">vl_int32</a> *&#160;</td>
          <td class="paramname"><em>integral</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>integralStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a03fa435c713d3141c4a700f79f5b2600">vl_int32</a> const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageStride</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#a63f63ca0445077d4baf05db04a1921e5" title="Compute integral image.">vl_imintegral_d</a>. </dd></dl>

</div>
</div>
<a class="anchor" id="ab02ddbe089220e3c33c548d2b45887a1"></a><!-- doxytag: member="imopv.h::vl_imintegral_ui32" ref="ab02ddbe089220e3c33c548d2b45887a1" args="(vl_uint32 *integral, vl_size integralStride, vl_uint32 const *image, vl_size imageWidth, vl_size imageHeight, vl_size imageStride)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_imintegral_ui32 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> *&#160;</td>
          <td class="paramname"><em>integral</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>integralStride</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> const *&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>imageStride</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="imopv_8h.html#a63f63ca0445077d4baf05db04a1921e5" title="Compute integral image.">vl_imintegral_d</a>. </dd></dl>

</div>
</div>
</div>
     <!-- Doc Here -->
    </div>
   
   </div>
   <div class="clear">&nbsp;</div>
  </div> <!-- pagebody -->
  <div id="footer">
   &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson
  </div> <!-- footer -->

  <!-- Google Analytics Begins -->
  <script xml:space="preserve" type="text/javascript">
   //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
   document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
   //]]>
  </script>
  <script xml:space="preserve" type="text/javascript">
    //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {

   try {
   var pageTracker = _gat._getTracker("UA-4936091-2");
   pageTracker._trackPageview();
   } catch(err) {}

   }
   //]]>
  </script>
  <!-- Google Analytics Ends -->
 </body>
</html>

 
